perm filename READ.TEX[WEB,ALS] blob sn#670603 filedate 1982-07-29 generic text, type C, neo UTF8
COMMENT āŠ—   VALID 00002 PAGES
C REC  PAGE   DESCRIPTION
C00001 00001
C00002 00002	\input basic
C00011 ENDMK
CāŠ—;
\input basic
%\magnify{1100}
\output{\page}
    \def\TEX{\hbox{T\hskip-.125em\lower.5ex\hbox{E}\hskip-.075em X}}
    \def\;{\char'40 }
    \def\dots{$\ldots$}
\font A=cmr9
\:A
\font T=cmtt9
\def\tt{\:T}
\def\lbrk{\hfil\linebreak}
\baselineskip 10pt
\parindent 0pt
\parskip 5pt

\ctrline{\:a This is a \TEX\ tape from Stanford University.}
\vskip 5pt

This tape is written in ASCII or EBCDIC at either 1600 bpi or 800
bpi as requested. The
information that it contains is in the public domain and may be reproduced
freely and distributed to others.  While we have made every effort to make
the tape free of error, we cannot guarantee its accuracy.

We would have liked to have sent you an exact duplicate of a number of
files that exist on our disk, but incompatabilities between tape handling
and files systems make this impossible.  Rather, each ``tape file''
represents one of our ``disk files.''  We hope that the representations we
have chosen will allow you to construct disk files of your own that
accuratly replicate ours.  This document explains the tape file
representations.

All of the blocks on this tape contain 2400 characters.  Each block
is considered to be 30 lines of 80 characters each. The lines are padded
with spaces and the blocks are padded with empty lines (i.e.\ lines of 80
spaces) as required.  None of the disk files we are sending has any lines
that are more than 80 characters long, so there is no problem with lines
getting split or truncated in the tape file and none has any lines with
significant trailing spaces.  As you read a tape file, you may
remove the trailing spaces at the end of each line, and the trailing blank
lines, if your computer is happy with this.

Each separate file is followed
by a tape mark and the last file on the tape is followed by an extra tape
mark.  Each tape file corresponds to one disk file.  The first line of
each tape file is an ID line that is not part of the disk file;  rather,
it tells the name of the corrosponding disk file, and tells which of two
representations the tape file is in.

The first representation is Text Format. This format is used for WEB, PASCAL,
\TEX, and other character-oriented files.
For instance, the file containing Web language source to the Tangle program
has an ID line like:\lbrk
{\tt
This is `TANGLE.WEB' in text format as of Jan.\ 28,\ 1982.\lbrk}
The rest of the tape file is a line-for-line copy of Tangle.
As noted above, all trailing spaces in each line and all trailing
blank lines may be removed as the tape file is transferred to disk.

The other representation is Decimal-Byte-Expansion Format.  This format is
used for files containg binary information, such as TFM and PXL files.
An ID line for a file in this format looks like:\lbrk
{\tt
This is `CMR10.TFM' in decimal-byte-expansion format as of Jan.\ 28,\ 1982.\lbrk}
In Decimal-Byte-Expansion format, each byte of the disk file is represented by
exactly four  ASCII characters on the tape file.  These characters are all in
the set $\{${\tt `\;', `0', `1', \dots, `9', `-'}$\}$
(where {\tt\;} stands for a space).
The four characters that represent a byte are
the decimal representation of the byte.  Thus, the only combinations you'll be
seeing are
{\tt `\;\;\;0',`\;\;\;1',\dots,`\;\;\;9',`\;\;10',\dots,`\;254', and `\;255'}.
The last byte's representation is followed by
{\tt `\;\;-1'} as an end of file indicator
(the {\tt `\;\;-1'} is not a part of the disk file).  Since 80 is evenly divisible
by four, there will be no problems with numbers getting split across the
80 character lines. You will find that all the binary disk files we send are
always a multiple of 4 bytes long, so the decimal-byte-expanded tape files
will always be a multiple of 16 characters long, not counting the {\tt `\;\;-1'} and
any padding following it. For example, a binary disk file that is twelve
bytes long might look like this on the tape:\lbrk
{\tt
This is `FOO.BAR' in decimal-byte-expansion format as of Feb.\ 29,\ 1984.\lbrk
\hbox{}\ 223 223 \ \ 1 \ \ 2 \ 99 199 \ \ 9 \ 10 123 255 \ 21 \ \ 0 \ -1\lbrk}

Here is a very short WEB program for converting a Decimal-Byte-Expanded tape
file back into a binary disk file:

\input webhdr

%\M1. Convert a Decimal-Byte-Expanded tape file back to a binary
%disk file exactly as it existed here at Stanford.

\Y\P\4\&{program}\1\  \37\\{undbe};\C{Pack a DBE file back into a file of
bytes}\6
\4\&{var} \37\\{dbefile}: \37\&{packed} \37\&{file} \1\&{of}\5
\\{char};\2\6
\\{bytefile}: \37\&{packed} \37\&{file} \1\&{of}\5
$0\to255$;\2\6
\|b: \37\\{integer};\6
\&{begin} \37$\\{reset}(\\{dbefile})$;\5
$\\{rewrite}(\\{bytefile})$;\6
$\\{readln}(\\{dbefile})$;\C{Skip the identification line}\6
$\\{read}(\\{dbefile},\39\|b)$;\C{Get the first byte into \|b}\6
\&{while} $\|b>-1$ \1\&{do}\6
\&{begin} \37$\\{write}(\\{bytefile},\39\|b)$;\5
$\\{read}(\\{dbefile},\39\|b)$;\6
\&{end};\2\6
\&{end}.\par

\vfill

\noindent Stanford University\lbrk
July 29, 1982\lbrk
drf,als

\end